package com.cskaoyan.com.linked;

public class DemoLinked3 {
    public static void main(String[] args) {

        // zs  <--->  ls  <---->  wu  <--->  zl
        DBNode zs = new DBNode(null,"zs", null);
        DBNode ls = new DBNode(zs, "ls", null);
        DBNode wu = new DBNode(ls, "wu", null);
        DBNode zl = new DBNode(wu, "zl", null);
        //  zs  <--   ls  <--    wu  <--  zl

        zs.next = ls;
        ls.next = wu;
        wu.next = zl;
        //  zs  <-->  ls  <--> wu  <--> zl


        // 改造成双向循环链表
        zs.pre = zl;
        zl.next = zs;

        System.out.println(zs);




//        // TODO: 如下是错误写法
//        // zs  <--->  ls  <---->  wu  <--->  zl
//        DBNode zs = new DBNode(null,"zs", ls);
//        DBNode ls = new DBNode(zs, "ls", wu);
//        DBNode wu = new DBNode(ls, "wu", zl);
//        DBNode zl = new DBNode(wu, "zl", null);
//        //  zs  <--->  ls  <---->  wu  <--->  zl



    }
}
